package edu.rakovic.elearning.service;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import edu.rakovic.elearning.interfaces.Exam;


public class ExamsBean implements Exams {
	
	public static long nextId = 1;
	private Map<String, Exam> exams = new HashMap<String, Exam>();
	
	/* (non-Javadoc)
	 * @see edu.rakovic.elearning.services.Exams#retreiveExams()
	 */
	public Collection<Exam> retreiveExams() {
		return exams.values();
	}
	
	/* (non-Javadoc)
	 * @see edu.rakovic.elearning.services.Exams#save(edu.rakovic.elearning.interfaces.Exam)
	 */
	public Exam save(Exam exam) {
		exam.setId("Exam" + nextId++);
		return exams.put(exam.getId(), exam);
	}
	
	

}
